package com.softgroup.breath.easyecgproject.windowbase;

import android.widget.Toast;

import com.softgroup.breath.easyecgproject.activity.CrashApplication;

public class ToastUtil {

    private final String[] TOAST_TEST = new String[]{"姓名有误！", "性别有误！", "年龄有误！", "暂停成功！", "恢复成功！",
            "切换至单通道模式!", "切换至六通道模式!", "未识别备用设备！"};
    private Toast toast;

    private static ToastUtil toastUtil;

    private ToastUtil() {
        toast = Toast.makeText(CrashApplication.getInstance(), "", Toast.LENGTH_SHORT);
    }

    public static ToastUtil getInstance() {
        if (toastUtil == null) {
            synchronized (ToastUtil.class) {
                if (toastUtil == null) {
                    toastUtil = new ToastUtil();
                }
            }
        }
        return toastUtil;
    }


    public void showToast(int sub) {
        toast.setText(TOAST_TEST[sub]);
        toast.setDuration(Toast.LENGTH_SHORT);
        toast.show();
    }
}
